
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<form id="customer-add"  method="post"  class="easyui-form">
    <table align="center" cellspacing="10" >
        <tr>
            <td>
                <input class="easyui-textbox" name="code" style="width:100%" data-options="label:'编码:',required:true">
            </td>
            <td>
            <input class="easyui-textbox" name="name" style="width:100%" data-options="label:'姓名:',required:true">
            </td>
            <td>  
                <input class="easyui-combobox" name="categoryId" label="分类:" style="width:100%" data-options="valueField:'id',textField:'name',method:'get',url:'api/people/category',required:true" />
            </td>
        </tr>
        <tr>
            <td>
                 <input class="easyui-textbox" name="contact01" style="width:100%" data-options="label:'联系人:',required:true">
            </td>
            <td>
                <input class="easyui-textbox" name="tel01" style="width:100%" data-options="label:'手机:',required:true">
            </td>
            <td> 
            <input class="easyui-textbox" name="qq01" style="width:100%" data-options="label:'QQ:'">
            </td>

        </tr>
        <tr>
            <td> 
            	<input class="easyui-textbox" name="mobile01" style="width:100%" data-options="label:'电话:'">
            </td>
            <td>
            	<input class="easyui-textbox" name="contact02" style="width:100%" data-options="label:'联系人2:'">
            </td>
            <td> 
            	<input class="easyui-textbox" name="qq02" style="width:100%" data-options="label:'QQ2:'">
            </td>
        </tr>
        <tr>
            <td> 
                <input class="easyui-textbox" name="tel02" style="width:100%" data-options="label:'手机2:'">
            </td>
            <td>
            <input class="easyui-textbox" name="mobile02" style="width:100%" data-options="label:'电话2:'">
            </td>
            <td> 
                <input class="easyui-textbox" name="address" style="width:100%" data-options="label:'地址:'">
            </td>
        </tr>
        <tr>
            <td>
            <input class="easyui-textbox" name="fax" style="width:100%" data-options="label:'传真:'">
            </td>
            <td> 
                <input class="easyui-textbox" name="initPayables" style="width:100%" data-options="label:'应收期初余额:'">
            </td>
            <td> 
                 <input class="easyui-datebox" name="initPayablesDt" style="width:100%" data-options="label:'日期:'">
            </td>
        </tr>
        <tr>
            <td>
             <input class="easyui-textbox" name="bankName" style="width:100%" data-options="label:'开户行:'">
            </td>
            <td>
            <input class="easyui-textbox" name="bankAccount" style="width:100%" data-options="label:'开户行账号:'">
            </td>
            <td>
             <input class="easyui-textbox" name="taxNumber" style="width:100%" data-options="label:'税号:'">
            </td>
        </tr>
        <tr>
            <td colspan="3"> 
            <input class="easyui-textbox" name="addressReceipt" style="width:100%;height:60px" data-options="label:'收货地址:',multiline:true">
            </td>
        </tr>
        <tr>
            <td colspan="3">
               <input class="easyui-textbox" name="note" style="width:100%;height:60px" data-options="label:'备注:',multiline:true">
            
            </td>
        </tr>
        <tr>
            <td colspan="3" align="center">
            <a  data-options="iconCls:'icon-ok'"  class="easyui-linkbutton" onclick="submitForm()" >保存</a>
            <a  data-options="iconCls:'icon-no'"  class="easyui-linkbutton" onclick="clearForm()" style="margin-left: 60px;">重置</a>
         </td>
        </tr>
    </table>
</form>
<script>
    function clearForm(){
        $('#customer-add').form('clear');
    };
    function submitForm(){
    	$('#customer-add').form('submit',{
    		url:'api/people/customer',
			onSubmit:function(){
				return $(this).form('enableValidation').form('validate');
			},success:function(data){
				data=eval('('+data+')');
				console.log(data);
				if(data.data!=null){
                    $.messager.show({
                        title:'温馨提示',
                        msg:data.message,
                        timeout:100000,
                        showType:'show',
                        timeout: 1000,
                        style: {
                            right: '',
                            bottom: ''
                        }
                    });
                    $('#customerAddDialog').dialog('close');
                    $('#customerGrid').datagrid('reload');
                }else{
                    $.messager.alert('失败提示',data.message,'warning');
                    $('#customer-add').form('clear');
                }
			}
		})
    }
</script>



